package cn.cvs.Service.Impl;

import cn.cvs.Factory.UserDaoFactory;
import cn.cvs.Service.UserService;
import cn.cvs.dao.Impl.UserDaoImpl;
import cn.cvs.dao.UserDao;
import cn.cvs.pojo.User;

import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * 用户模块业务层实现
 */

public class UserServiceImpl implements UserService {
    //实例化所依赖的UserDao对象


    private UserDao userDao;

    public UserServiceImpl(UserDao userDao) {
        this.userDao = userDao;
    }

    /**
     * 保存用户信息
     * @param user
     */
    @Override
    public void save(User user) {
        //调用UserDao的方法保存用户信息
        userDao.save(user);
    }

    public void setDao(UserDaoImpl dao) {
    }
    /**
     * dao属性的setter访问器，会被Spring调用，实现依赖注入
     */
    public void setUserDao(UserDao userDao) {
        this.userDao = userDao;
    }
}
